package scuts.core;

import scuts.core.types.LazyIterator;

class AnyIterable 
{

  public static function any<T>(iter:Iterable<T>, f:T->Bool):Bool 
  {
    return AnyIterator.any(iter.iterator(), f);
  }
  
}

class AnyIterator 
{

  public static function any<T>(iter:Iterator<T>, f:T->Bool):Bool
  {
    for (e in iter) {
      if (f(e)) return true;
    }
    return false;
  }
  
}

class AnyLazyIterator 
{
  public static function any<T>(iter:LazyIterator<T>, f:T->Bool):Bool
  {
    return AnyIterator.any(iter(), f);
  }
}